<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@include file="../../common/operation_forbid.jsp" %>
<%@include file="../../common/jsVersion.jsp"%>
<c:set var="contextPath" value="${pageContext.request.contextPath}"/>
<script type="text/javascript">
    var contextPath = '${contextPath}';
    var shouStatus = '${shouStatus}';
    var subscribeId='${subscribeId}';
    var documentType=${documentType};
    var paymentMethods=${paymentMethods};
    var contactTypes=${contactTypes};
    var processFlag='${processFlag}';
    var userName="${userName}";
	var haveReceivedPayDepositAmount=0;
	var currentUserName='小张';
	var currentUserId='1';
	var process = '${process}';
    var returnUrl = '${returnUrl}';
    var auditStatus = '${auditStatus}';
    var businessStatus = '${businessStatus}';
    var businessAbnormaId = '${businessAbnormaId}';
    var procInstId = '${procInstId}';
    var huanStatus = '${huanStatus}'; 
    var returnBackParam="${returnBackParam}";
    var payDepositOff=${payDepositOff};
    var oldSignedId='${oldSignedId}';
</script>
<!DOCTYPE html >
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>签约详情</title>
    <!-- neptune -->
    <%@include file="../../common/extInclude.jsp" %>
    <script type="text/javascript" src="${contextPath}/static/js/customer/signed/signedChangeHouseDetail.js?v=${jsVersion}"></script>
    <script type="text/javascript" src="${contextPath}/static/js/marketing/changecontact/signedcontactchange.js?v=${jsVersion}"></script>
          <script type="text/javascript" src="${contextPath}/static/js/components/processHistory.js?v=${jsVersion}"></script>
     <script type="text/javascript" src="${contextPath}/static/js/jquery/json2.js"></script> 
     <script type="text/javascript" src="${contextPath}/static/js/components/fileComponent.js?v=${jsVersion}"></script>
    <script type="text/javascript">
 	var menu = '${menu}';
 	var idata = '${permitBtn}';
 	var contactChangeFlag = ${contactChangeFlag};
 	if(idata!=null||idata!=""){
		idata=JSON.parse(idata);
	}
    </script>
</head>
<script type="text/javascript">
function initSignedFile(httpUrl){
	if(null==httpUrl || httpUrl=="")return;
	var imgsArray=httpUrl.split("|");
	for(var i=0;i<imgsArray.length;i++){
		var rowFileUrl=imgsArray[i];
		var imgs="<a href='"+rowFileUrl+"' target='_blank'><img style='width: 80px; height: 90px;' src='"+rowFileUrl+"'/></a>";
		var imgPanel = Ext.create("Ext.Panel", {
	        html: imgs
		})
		var showImgPanel=Ext.getCmp("signedFileFormPanel");
		showImgPanel.add(imgPanel);
	}
	
	Ext.getCmp("signedFileForm").show();
}
Ext.onReady(function() {
	var viewPanel=Ext.create("customer.subscribe.viewPanel");
 	var estateRecord = JSON.parse('${estateRecord}');
 	var customerRecord = JSON.parse('${customerRecord}');
 	var signedRecord = JSON.parse('${signedRecord}');  
	//初始化值
	viewPanel.getComponent("estatePanel").getForm().setValues(estateRecord);
 	viewPanel.getComponent("customerPanel").getForm().setValues(customerRecord);
 	viewPanel.getComponent("subscribeInfoForm").getForm().setValues(signedRecord);
 	initSignedFile(signedRecord.signedFileUrl);
 	
 	//当装修款为空时，赋值为0
 	var decorationMoney = 0;
 	if(signedRecord.decorationMoney != undefined){
 		decorationMoney = signedRecord.decorationMoney;
 	}
 	//设置合同总金额
 	Ext.getCmp("signAmount").setValue(signedRecord.signAmount + decorationMoney);
	//设置房款金额
	Ext.getCmp("roomTotalAmount").setValue(signedRecord.signAmount);
	//设置装修款
	Ext.getCmp("decorationMoneyAmount").setValue(decorationMoney);
	
 	Ext.getCmp("didTime").setValue(Ext.Date.format(new Date(signedRecord.didTime),'Y-m-d'));
 	var process = '${process}';
 	//流程审批时候 隐藏按钮
 	if(process!=null&&process!=""){
 		Ext.getCmp("proceedsBut").setVisible(false);
 	}
 	
 	//审核历史,展示当前审核状态
	/* var currAutidStatus = "";
	if(auditStatus == "0"){
		currAuditStatus = "<font style='color: red;'>待提交</font>";
	}else if(auditStatus == "1"){
		currAuditStatus = "<font style='color: red;'>审核中</font>";
	}else if(auditStatus == "2"){
		currAuditStatus = "<font style='color: red;'>已退回</font>";
	}else if(auditStatus == "3"){
		currAuditStatus = "<font style='color: red;'>已通过</font>";
	}
 	Ext.getCmp("currAuditStatus").setValue(currAuditStatus); */
 	
 	if(processFlag=="true" || processFlag==true){
 		Ext.getCmp("retrunBtn").setVisible(false);
 		//审批历史隐藏
 		Ext.getCmp("historyPanel").setVisible(false);
 		marketingSignedShou = true;
 	}
 	
});
</script>
<body>
</body>
</html>